package com.qa.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qa.IDao.Temp_lbtMapper;
import com.qa.IDao.Temp_user_useMapper;
import com.qa.IDao.UsersMapper;
import com.qa.pojo.DeptAndProInfo;
import com.qa.pojo.Temp_WqtWeb;
import com.qa.pojo.Temp_lbt;
import com.qa.pojo.Temp_user_use;
import com.qa.pojo.Temp_zzttWeb;
import com.qa.pojo.Users;
import com.qa.service.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService {
	@Resource
	private UsersMapper userDao;
	@Resource
	private Temp_user_useMapper temp_user_useDao;
	@Resource
	private Temp_lbtMapper temp_lbtDao;

	public Users getUserById(int userId) {
		// TODO Auto-generated method stub
		return this.userDao.selectByPrimaryKey(userId);
	}

	@Override
	public Users getUserByNameAndPass(String username, String password) {
		Users users = this.userDao.selectByNameAndPass(username, password);
		if (users != null) {
			this.userDao.insertLoginlog(users.getUsersid());
		}
		return users;
	}

	@Override
	public int insertUsers(Users user, int juese, int bumen, int xiangmu) {
		// TODO Auto-generated method stub
		return this.userDao.insertUsers(user.getUsername(), user.getPassword(),
				user.getName(), juese, bumen, xiangmu);
	}

	@Override
	public Temp_user_use getPerHeaderType(int usersid) {
		// TODO Auto-generated method stub
		return this.temp_user_useDao.selectByPrimaryKey(usersid);
	}

	@Override
	public List<Temp_lbt> getPerHeader(Integer tempid) {
		// TODO Auto-generated method stub
		return temp_lbtDao.selectByTempId(tempid);
	}

	@Override
	public Temp_WqtWeb getWqtWebHeader(Integer tempid) {
		// TODO Auto-generated method stub
		return temp_lbtDao.selectWqtWebHeader(tempid);
	}

	@Override
	public Temp_zzttWeb getZzttWebHeader(Integer tempid) {
		// TODO Auto-generated method stub
		return temp_lbtDao.selectZzttWebHeader(tempid);
	}

	@Override
	public List<DeptAndProInfo> getRegisterInfo() {
		// TODO Auto-generated method stub
		return this.userDao.getRegInfo();
	}
}